* settings:
* $wgUseTex*, $wgUseDynamicDates*, $wgInterwikiMagic*,
* $wgNamespacesWithSubpages, $wgAllowExternalImages*,
- * $wgLocaltimezone, $wgAllowSpecialInclusion*,
+ * $wgLocaltimezone, $wgAllowSpecialInclusion*,
* $wgMaxArticleSize*
*
* * only within ParserOptions
if ( $wgAllowSlowParserFunctions ) {
$this->setFunctionHook( 'pagesinnamespace', array( 'CoreParserFunctions', 'pagesinnamespace' ), SFH_NO_HASH );
}
-
+
$this->initialiseVariables();
$this->mFirstCall = false;
wfProfileOut( __METHOD__ );
- }
+ }
/**
* Clear Parser state
'titles' => array()
);
$this->mRevisionId = null;
-
+
/**
* Prefix for temporary replacement strings for the multipass parser.
* \x07 should never appear in input as it's disallowed in XML.
$text = $q[2];
}
}
-
+
$matches[$marker] = array( $element,
$content,
Sanitizer::decodeTagAttributes( $attributes ),
* will be stripped in addition to other tags. This is important
* for section editing, where these comments cause confusion when
* counting the sections in the wikisource
- *
+ *
* @param array dontstrip contains tags which should not be stripped;
* used to prevent stipping of <gallery> when saving (fixes bug 2700)
*
$uniq_prefix = $this->mUniqPrefix;
$commentState = array();
-
+
$elements = array_merge(
array( 'nowiki', 'gallery' ),
array_keys( $this->mTagHooks ) );
if( $this->mOptions->getUseTeX() ) {
$elements[] = 'math';
}
-
+
# Removing $dontstrip tags from $elements list (currently only 'gallery', fixing bug 2700)
foreach ( $elements AS $k => $v ) {
if ( !in_array ( $v , $dontstrip ) ) continue;
unset ( $elements[$k] );
}
-
+
$matches = array();
$text = Parser::extractTagsAndParams( $elements, $text, $matches, $uniq_prefix );
$output = $tag;
}
- // Unstrip the output, because unstrip() is no longer recursive so
+ // Unstrip the output, because unstrip() is no longer recursive so
// it won't do it itself
$output = $this->unstrip( $output, $state );
* always call unstripNoWiki() after this one
* @private
*/
- function unstrip( $text, &$state ) {
+ function unstrip( $text, $state ) {
if ( !isset( $state['general'] ) ) {
return $text;
}
*
* @private
*/
- function unstripNoWiki( $text, &$state ) {
+ function unstripNoWiki( $text, $state ) {
if ( !isset( $state['nowiki'] ) ) {
return $text;
}
# TODO: good candidate for FSS
$text = strtr( $text, $state['nowiki'] );
wfProfileOut( __METHOD__ );
-
+
return $text;
}
{
$x = trim ( $x ) ;
$fc = substr ( $x , 0 , 1 ) ;
+ $matches = array();
if ( preg_match( '/^(:*)\{\|(.*)$/', $x, $matches ) ) {
$indent_level = strlen( $matches[1] );
$l = array_pop ( $ltd ) ;
if ( array_pop ( $td ) ) $z = '</'.$l.'>' . $z ;
- if ( $fc == '|' ) $l = 'td' ;
- else if ( $fc == '!' ) $l = 'th' ;
- else if ( $fc == '+' ) $l = 'caption' ;
- else $l = '' ;
+ if ( $fc == '|' ) {
+ $l = 'td' ;
+ } else if ( $fc == '!' ) {
+ $l = 'th' ;
+ } else if ( $fc == '+' ) {
+ $l = 'caption' ;
+ } else {
+ $l = '' ;
+ }
array_push ( $ltd , $l ) ;
# Cell parameters
wfProfileIn( $fname );
# Hook to suspend the parser in this state
+ $x =& $this->mStripState; // FIXME: Please check that this initialization is correct.
if ( !wfRunHooks( 'ParserBeforeInternalParse', array( &$this, &$text, &$x ) ) ) {
wfProfileOut( $fname );
return $text ;
*/
function &doMagicLinks( &$text ) {
wfProfileIn( __METHOD__ );
- $text = preg_replace_callback(
+ $text = preg_replace_callback(
'!(?: # Start cases
<a.*?</a> | # Skip link text
<.*?> | # Skip stuff inside HTML elements
ISBN\s+([0-9Xx-]+) # ISBN, capture number as m[2]
)!x', array( &$this, 'magicLinkCallback' ), $text );
wfProfileOut( __METHOD__ );
- return $text;
+ return $text;
}
function magicLinkCallback( $m ) {
return $m[0];
} elseif ( substr( $m[0], 0, 4 ) == 'ISBN' ) {
$isbn = $m[2];
- $num = strtr( $isbn, array(
+ $num = strtr( $isbn, array(
'-' => '',
' ' => '',
'x' => 'X',
$urlmsg = 'pubmedurl';
$id = $m[1];
} else {
- throw new MWException( __METHOD__.': unrecognised match type "' .
+ throw new MWException( __METHOD__.': unrecognised match type "' .
substr($m[0], 0, 20 ) . '"' );
}
-
+
$url = wfMsg( $urlmsg, $id);
$sk =& $this->mOptions->getSkin();
$la = $sk->getExternalLinkAttributes( $url, $keyword.$id );
}
# Count the number of occurrences of bold and italics mark-ups.
# We are not counting sequences of five apostrophes.
- if ( strlen( $arr[$i] ) == 2 ) $numitalics++; else
- if ( strlen( $arr[$i] ) == 3 ) $numbold++; else
- if ( strlen( $arr[$i] ) == 5 ) { $numitalics++; $numbold++; }
+ if ( strlen( $arr[$i] ) == 2 ) { $numitalics++; }
+ else if ( strlen( $arr[$i] ) == 3 ) { $numbold++; }
+ else if ( strlen( $arr[$i] ) == 5 ) { $numitalics++; $numbold++; }
}
$i++;
}
# The characters '<' and '>' (which were escaped by
# removeHTMLtags()) should not be included in
# URLs, per RFC 2396.
+ $m2 = array();
if (preg_match('/&(lt|gt);/', $url, $m2, PREG_OFFSET_CAPTURE)) {
$text = substr($url, $m2[0][1]) . ' ' . $text;
$url = substr($url, 0, $m2[0][1]);
}
$text = $wgContLang->markNoConversion($text);
-
+
$url = Sanitizer::cleanUrl( $url );
# Process the trail (i.e. everything after this link up until start of the next link),
$protocol = $bits[$i++];
$remainder = $bits[$i++];
+ $m = array();
if ( preg_match( '/^('.EXT_LINK_URL_CLASS.'+)(.*)$/s', $remainder, $m ) ) {
# Found some characters after the protocol that look promising
$url = $protocol . $m[1];
# special case: handle urls as url args:
# http://www.example.com/foo?=http://www.example.com/bar
- if(strlen($trail) == 0 &&
+ if(strlen($trail) == 0 &&
isset($bits[$i]) &&
preg_match('/^'. wfUrlProtocols() . '$/S', $bits[$i]) &&
- preg_match( '/^('.EXT_LINK_URL_CLASS.'+)(.*)$/s', $bits[$i + 1], $m ))
+ preg_match( '/^('.EXT_LINK_URL_CLASS.'+)(.*)$/s', $bits[$i + 1], $m ))
{
# add protocol, arg
$url .= $bits[$i] . $m[1]; # protocol, url as arg to previous link
# The characters '<' and '>' (which were escaped by
# removeHTMLtags()) should not be included in
# URLs, per RFC 2396.
+ $m2 = array();
if (preg_match('/&(lt|gt);/', $url, $m2, PREG_OFFSET_CAPTURE)) {
$trail = substr($url, $m2[0][1]) . $trail;
$url = substr($url, 0, $m2[0][1]);
$nottalk = !$this->mTitle->isTalkPage();
if ( $useLinkPrefixExtension ) {
+ $m = array();
if ( preg_match( $e2, $s, $m ) ) {
$first_prefix = $m[2];
} else {
# Still some problems for cases where the ] is meant to be outside punctuation,
# and no image is in sight. See bug 2095.
#
- if( $text !== '' &&
- substr( $m[3], 0, 1 ) === ']' &&
- strpos($text, '[') !== false
- )
+ if( $text !== '' &&
+ substr( $m[3], 0, 1 ) === ']' &&
+ strpos($text, '[') !== false
+ )
{
$text .= ']'; # so that replaceExternalLinks($text) works later
$m[3] = substr( $m[3], 1 );
$ns = $nt->getNamespace();
$iw = $nt->getInterWiki();
wfProfileOut( "$fname-title" );
-
+
if ($might_be_img) { # if this is actually an invalid link
wfProfileIn( "$fname-might_be_img" );
if ($ns == NS_IMAGE && $noforce) { #but might be an image
* expensive to check many times.
*/
static $varCache = array();
- if ( wfRunHooks( 'ParserGetVariableValueVarCache', array( &$this, &$varCache ) ) )
- if ( isset( $varCache[$index] ) )
+ if ( wfRunHooks( 'ParserGetVariableValueVarCache', array( &$this, &$varCache ) ) ) {
+ if ( isset( $varCache[$index] ) ) {
return $varCache[$index];
+ }
+ }
$ts = time();
wfRunHooks( 'ParserGetVariableValueTs', array( &$this, &$ts ) );
$lastOpeningBrace = -1; # last not closed parentheses
$validOpeningBraces = implode( '', array_keys( $callbacks ) );
-
+
$i = 0;
while ( $i < strlen( $text ) ) {
# Find next opening brace, closing brace or pipe
$maxCount = $openingBraceStack[$lastOpeningBrace]['count'];
$count = strspn( $text, $text[$i], $i, $maxCount );
- # check for maximum matching characters (if there are 5 closing
+ # check for maximum matching characters (if there are 5 closing
# characters, we will probably need only 3 - depending on the rules)
$matchingCount = 0;
$matchingCallback = null;
$cbType = $callbacks[$openingBraceStack[$lastOpeningBrace]['brace']];
if ( $count > $cbType['max'] ) {
- # The specified maximum exists in the callback array, unless the caller
+ # The specified maximum exists in the callback array, unless the caller
# has made an error
$matchingCount = $cbType['max'];
} else {
# let's set a title or last part (if '|' was found)
if (null === $openingBraceStack[$lastOpeningBrace]['parts']) {
- $openingBraceStack[$lastOpeningBrace]['title'] =
- substr($text, $openingBraceStack[$lastOpeningBrace]['partStart'],
+ $openingBraceStack[$lastOpeningBrace]['title'] =
+ substr($text, $openingBraceStack[$lastOpeningBrace]['partStart'],
$i - $openingBraceStack[$lastOpeningBrace]['partStart']);
} else {
- $openingBraceStack[$lastOpeningBrace]['parts'][] =
- substr($text, $openingBraceStack[$lastOpeningBrace]['partStart'],
+ $openingBraceStack[$lastOpeningBrace]['parts'][] =
+ substr($text, $openingBraceStack[$lastOpeningBrace]['partStart'],
$i - $openingBraceStack[$lastOpeningBrace]['partStart']);
}
} elseif ( $found == 'pipe' ) {
# lets set a title if it is a first separator, or next part otherwise
if (null === $openingBraceStack[$lastOpeningBrace]['parts']) {
- $openingBraceStack[$lastOpeningBrace]['title'] =
- substr($text, $openingBraceStack[$lastOpeningBrace]['partStart'],
+ $openingBraceStack[$lastOpeningBrace]['title'] =
+ substr($text, $openingBraceStack[$lastOpeningBrace]['partStart'],
$i - $openingBraceStack[$lastOpeningBrace]['partStart']);
$openingBraceStack[$lastOpeningBrace]['parts'] = array();
} else {
- $openingBraceStack[$lastOpeningBrace]['parts'][] =
- substr($text, $openingBraceStack[$lastOpeningBrace]['partStart'],
+ $openingBraceStack[$lastOpeningBrace]['parts'][] =
+ substr($text, $openingBraceStack[$lastOpeningBrace]['partStart'],
$i - $openingBraceStack[$lastOpeningBrace]['partStart']);
}
$openingBraceStack[$lastOpeningBrace]['partStart'] = ++$i;
$braceCallbacks[3] = array( &$this, 'argSubstitution' );
}
if ( $braceCallbacks ) {
- $callbacks = array(
+ $callbacks = array(
'{' => array(
'end' => '}',
'cb' => $braceCallbacks,
'min' => $argsOnly ? 3 : 2,
'max' => isset( $braceCallbacks[3] ) ? 3 : 2,
),
- '[' => array(
- 'end' => ']',
+ '[' => array(
+ 'end' => ']',
'cb' => array(2=>null),
'min' => 2,
'max' => 2,
* @private
*/
function braceSubstitution( $piece ) {
- global $wgContLang, $wgLang, $wgAllowDisplayTitle, $action;
+ global $wgContLang, $wgLang, $wgAllowDisplayTitle;
$fname = __METHOD__ /*. '-L' . count( $this->mArgStack )*/;
wfProfileIn( $fname );
wfProfileIn( __METHOD__.'-setup' );
$linestart = '';
-
+
# $part1 is the bit before the first |, and must contain only title characters
# $args is a list of arguments, starting from index 0, not including $part1
}
$args = (null == $piece['parts']) ? array() : $piece['parts'];
- $argc = count( $args );
wfProfileOut( __METHOD__.'-setup' );
# SUBST
$mwMsg =& MagicWord::get( 'msg' );
$mwMsg->matchStartAndRemove( $part1 );
}
-
+
# Check for RAW:
$mwRaw =& MagicWord::get( 'raw' );
if ( $mwRaw->matchStartAndRemove( $part1 ) ) {
# Parser functions
if ( !$found ) {
wfProfileIn( __METHOD__ . '-pfunc' );
-
+
$colonPos = strpos( $part1, ':' );
if ( $colonPos !== false ) {
# Case sensitive functions
if ( !$noparse ) {
# If there are any <onlyinclude> tags, only include them
if ( in_string( '<onlyinclude>', $text ) && in_string( '</onlyinclude>', $text ) ) {
+ $m = array();
preg_match_all( '/<onlyinclude>(.*?)\n?<\/onlyinclude>/s', $text, $m );
$text = '';
foreach ($m[1] as $piece)
# If the template begins with a table or block-level
# element, it should be treated as beginning a new line.
- if (!$piece['lineStart'] && preg_match('/^({\\||:|;|#|\*)/', $text)) /*}*/{
+ if (!$piece['lineStart'] && preg_match('/^({\\||:|;|#|\*)/', $text)) /*}*/{
$text = "\n" . $text;
}
} elseif ( !$noargs ) {
$text .= $hl;
continue;
}
+ $m2 = array();
preg_match('/^(={1,6})(.*?)(={1,6})\s*?$/m', $hl, $m2);
$text .= $m2[1] . $m2[2] . "<!--MWTEMPLATESECTION="
. $encodedname . "&" . base64_encode("$nsec") . "-->" . $m2[3];
if ( array_key_exists( $arg, $inputArgs ) ) {
$text = $inputArgs[$arg];
- } else if (($this->mOutputType == OT_HTML || $this->mOutputType == OT_PREPROCESS ) &&
+ } else if (($this->mOutputType == OT_HTML || $this->mOutputType == OT_PREPROCESS ) &&
null != $matches['parts'] && count($matches['parts']) > 0) {
$text = $matches['parts'][0];
}
# Get all headlines for numbering them and adding funky stuff like [edit]
# links - this is for later, but we need the number of headlines right now
+ $matches = array();
$numMatches = preg_match_all( '/<H([1-6])(.*?'.'>)(.*?)<\/H[1-6] *>/i', $text, $matches );
# if there are fewer than 4 headlines in the article, do not show TOC
$templatetitle = '';
$templatesection = 0;
$numbering = '';
-
+ $mat = array();
if (preg_match("/<!--MWTEMPLATESECTION=([^&]+)&([^_]+)-->/", $headline, $mat)) {
$istemplate = 1;
$templatetitle = base64_decode($mat[1]);
* @return string the altered wiki markup
* @public
*/
- function preSaveTransform( $text, &$title, &$user, $options, $clearState = true ) {
+ function preSaveTransform( $text, &$title, $user, $options, $clearState = true ) {
$this->mOptions = $options;
$this->mTitle =& $title;
$this->setOutputType( OT_WIKI );
* Pre-save transform helper function
* @private
*/
- function pstPass2( $text, &$stripState, &$user ) {
+ function pstPass2( $text, &$stripState, $user ) {
global $wgContLang, $wgLocaltimezone;
/* Note: This is the timestamp saved as hardcoded wikitext to
$text = preg_replace( $p3, '[[\\1\\2\\3\\4|\\2]]', $text );
$t = $this->mTitle->getText();
+ $m = array();
if ( preg_match( "/^($nc+:|)$tc+?( \\($tc+\\))$/", $t, $m ) ) {
$text = preg_replace( $p2, "[[$m[1]\\1$m[2]|\\1]]", $text );
} elseif ( preg_match( "/^($nc+:|)$tc+?(, $tc+|)$/", $t, $m ) && '' != "$m[1]$m[2]" ) {
* The callback function should have the form:
* function myParserFunction( &$parser, $arg1, $arg2, $arg3 ) { ... }
*
- * The callback may either return the text result of the function, or an array with the text
- * in element 0, and a number of flags in the other elements. The names of the flags are
+ * The callback may either return the text result of the function, or an array with the text
+ * in element 0, and a number of flags in the other elements. The names of the flags are
* specified in the keys. Valid flags are:
- * found The text returned is valid, stop processing the template. This
+ * found The text returned is valid, stop processing the template. This
* is on by default.
* nowiki Wiki markup in the return value should be escaped
* noparse Unsafe HTML tags should not be stripped, etc.
*
* @param string $id The magic word ID
* @param mixed $callback The callback function (and object) to use
- * @param integer $flags a combination of the following flags:
+ * @param integer $flags a combination of the following flags:
* SFH_NO_HASH No leading hash, i.e. {{plural:...}} instead of {{#if:...}}
*
* @return The old callback function for this name, if any
function replaceLinkHolders( &$text, $options = 0 ) {
global $wgUser;
global $wgOutputReplace;
- global $wgContLang, $wgLanguageCode;
+ global $wgContLang;
$fname = 'Parser::replaceLinkHolders';
wfProfileIn( $fname );
# Generate query
$query = false;
+ $current = null;
foreach ( $this->mLinkHolders['namespaces'] as $key => $ns ) {
# Make title object
$title = $this->mLinkHolders['titles'][$key];
# Do a second query for different language variants of links (if needed)
if($wgContLang->hasVariants()){
- $linkBatch = new LinkBatch();
+ $linkBatch = new LinkBatch();
$variantMap = array(); // maps $pdbkey_Variant => $pdbkey_original
// Add variants of links to link batch
}
}
}
-
+
if(!$linkBatch->isEmpty()){
// construct query
$holderKeys = $variantMap[$varPdbk];
// loop over link holders
- foreach($holderKeys as $key){
+ foreach($holderKeys as $key){
$title = $this->mLinkHolders['titles'][$key];
if ( is_null( $title ) ) continue;
// found link in some of the variants, replace the link holder data
$this->mLinkHolders['titles'][$key] = $variantTitle;
$this->mLinkHolders['dbkeys'][$key] = $variantTitle->getDBkey();
-
+
// set pdbk and colour
$pdbks[$key] = $varPdbk;
if ( $threshold > 0 ) {
} else {
$colours[$varPdbk] = 2;
}
- }
+ }
else {
$colours[$varPdbk] = 1;
- }
+ }
}
}
}
/**
* Tag hook handler for 'pre'.
*/
- function renderPreTag( $text, $attribs, $parser ) {
+ function renderPreTag( $text, $attribs ) {
// Backwards-compatibility hack
$content = preg_replace( '!<nowiki>(.*?)</nowiki>!is', '\\1', $text );
foreach ( $lines as $line ) {
# match lines like these:
# Image:someimage.jpg|This is some image
+ $matches = array();
preg_match( "/^([^|]+)(\\|(.*))?$/", $line, $matches );
# Skip empty lines
if ( count( $matches ) == 0 ) {
/**
* Parse image options text and use it to make an image
*/
- function makeImage( &$nt, $options ) {
+ function makeImage( $nt, $options ) {
global $wgUseImageResize, $wgDjvuRenderer;
$align = '';
$page = null;
$manual_thumb = '' ;
- foreach( $part as $key => $val ) {
+ foreach( $part as $val ) {
if ( $wgUseImageResize && ! is_null( $mwThumb->matchVariableStartToEnd($val) ) ) {
$thumb=true;
} elseif ( ! is_null( $match = $mwManualThumb->matchVariableStartToEnd($val) ) ) {
} elseif ( $wgUseImageResize && ! is_null( $match = $mwWidth->matchVariableStartToEnd($val) ) ) {
wfDebug( "img_width match: $match\n" );
# $match is the image width in pixels
+ $m = array();
if ( preg_match( '/^([0-9]*)x([0-9]*)$/', $match, $m ) ) {
$width = intval( $m[1] );
$height = intval( $m[2] );
# make sure there are no placeholders in thumbnail attributes
# that are later expanded to html- so expand them now and
# remove the tags
- $alt = $this->unstrip($alt, $this->mStripState);
+ $alt = $this->unstrip($alt, $this->mStripState);
$alt = Sanitizer::stripAllTags( $alt );
# Linker does the rest
function addImage( $name ) { $this->mImages[$name] = 1; }
function addLanguageLink( $t ) { $this->mLanguageLinks[] = $t; }
function addExternalLink( $url ) { $this->mExternalLinks[$url] = 1; }
-
+
function setNewSection( $value ) {
$this->mNewSection = (bool)$value;
}
class ParserOptions
{
# All variables are private
- var $mUseTeX; # Use texvc to expand <math> tags
- var $mUseDynamicDates; # Use DateFormatter to format dates
- var $mInterwikiMagic; # Interlanguage links are removed and returned in an array
- var $mAllowExternalImages; # Allow external images inline
- var $mAllowExternalImagesFrom; # If not, any exception?
- var $mSkin; # Reference to the preferred skin
- var $mDateFormat; # Date format index
- var $mEditSection; # Create "edit section" links
- var $mNumberHeadings; # Automatically number headings
- var $mAllowSpecialInclusion; # Allow inclusion of special pages
- var $mTidy; # Ask for tidy cleanup
- var $mInterfaceMessage; # Which lang to call for PLURAL and GRAMMAR
- var $mMaxIncludeSize; # Maximum size of template expansions, in bytes
- var $mRemoveComments; # Remove HTML comments. ONLY APPLIES TO PREPROCESS OPERATIONS
-
- var $mUser; # Stored user object, just used to initialise the skin
+ private $mUseTeX; # Use texvc to expand <math> tags
+ private $mUseDynamicDates; # Use DateFormatter to format dates
+ private $mInterwikiMagic; # Interlanguage links are removed and returned in an array
+ private $mAllowExternalImages; # Allow external images inline
+ private $mAllowExternalImagesFrom; # If not, any exception?
+ private $mSkin; # Reference to the preferred skin
+ private $mDateFormat; # Date format index
+ private $mEditSection; # Create "edit section" links
+ private $mNumberHeadings; # Automatically number headings
+ private $mAllowSpecialInclusion; # Allow inclusion of special pages
+ private $mTidy; # Ask for tidy cleanup
+ private $mInterfaceMessage; # Which lang to call for PLURAL and GRAMMAR
+ private $mMaxIncludeSize; # Maximum size of template expansions, in bytes
+ private $mRemoveComments; # Remove HTML comments. ONLY APPLIES TO PREPROCESS OPERATIONS
+
+ private $mUser; # Stored user object, just used to initialise the skin
function getUseTeX() { return $this->mUseTeX; }
function getUseDynamicDates() { return $this->mUseDynamicDates; }
return $this->mSkin;
}
- function getDateFormat() {
+ function getDateFormat() {
if ( !isset( $this->mDateFormat ) ) {
$this->mDateFormat = $this->mUser->getDatePreference();
}
function setNumberHeadings( $x ) { return wfSetVar( $this->mNumberHeadings, $x ); }
function setAllowSpecialInclusion( $x ) { return wfSetVar( $this->mAllowSpecialInclusion, $x ); }
function setTidy( $x ) { return wfSetVar( $this->mTidy, $x); }
- function setSkin( &$x ) { $this->mSkin =& $x; }
+ function setSkin( $x ) { $this->mSkin = $x; }
function setInterfaceMessage( $x ) { return wfSetVar( $this->mInterfaceMessage, $x); }
function setMaxIncludeSize( $x ) { return wfSetVar( $this->mMaxIncludeSize, $x ); }
function setRemoveComments( $x ) { return wfSetVar( $this->mRemoveComments, $x ); }
function wfRevisionTimestamp( $id ) {
global $wgContLang;
$fname = 'wfRevisionTimestamp';
-
+
wfProfileIn( $fname );
$dbr =& wfGetDB( DB_SLAVE );
$timestamp = $dbr->selectField( 'revision', 'rev_timestamp',